package org.cscarioni

import java.util.Set;

class Team {
	String name
	Set estimatedTimes
	int storyPoints
	int storyPointsLeft
	static hasMany =[users: User,estimatedTimes:EstimatedTimeHistoryForTeam]
	static transients = ["storyPoints","storyPointsLeft"] 
    static constraints = {
    }
	
	String toString(){
		name
	}
	
	public int getStoryPoints(){
		def suma=0
		users.each{
			it.tasks.each{suma += it.estimatedTime}
		}
		return suma
	}
	public int getStoryPointsLeft(){
		def suma=0
		users.each{
			it.tasks.each{suma += it.remainingTime}
		}
		return suma
	}
}
